Skip to content

Guard resource usage stats slices#460

Open
giwaov wants to merge 1 commit into
canopy-network:mainfrom
giwaov:issue-resource-usage-empty-stats
Open

Guard resource usage stats slices#460
giwaov wants to merge 1 commit into
canopy-network:mainfrom
giwaov:issue-resource-usage-empty-stats

Conversation

@giwaov

@giwaov giwaov commented Jul 4, 2026

Copy link
Copy Markdown

Summary

  • Build system resource usage through a helper that validates CPU and network stats are present.
  • Return an internal server error instead of indexing empty gopsutil result slices.
  • Add coverage for missing CPU percent, CPU time, and network IO stats.

Why

The resource-usage admin endpoint indexed cp[0], c[0], and ioCounters[0] directly. If gopsutil returns an empty slice for any of those calls, the endpoint can panic instead of returning a handled error.

Testing

  • git diff --check
  • Not run: Go toolchain is not installed in this environment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant